import 'package:flutter/material.dart';

import 'package:get/get.dart';
import 'package:ruida_bottom_demo/app/components/lottie_icon.dart';

import '../controllers/bottom13_controller.dart';

class Bottom13View extends GetView<Bottom13Controller> {
  const Bottom13View({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('一往情深底部菜单'),
        centerTitle: true,
      ),
      body: Obx(() {
        return Center(
          child: Text(
            'Bottom13View is working ${controller.currentIndex.value}',
            style: const TextStyle(fontSize: 20),
          ),
        );
      }),
      bottomNavigationBar: Obx(() {
        return BottomNavigationBar(
          type: BottomNavigationBarType.fixed,
          items: [
            BottomNavigationBarItem(
                icon: SizedBox(
                    width: 34,
                    height: 34,
                    child: Image.asset("assets/svga/tab/ic_home.png")),
                label: "首页",
                activeIcon: const SizedBox(
                    width: 34,
                    height: 34,
                    child: LottieIcon(
                      name: 'assets/svga/json/home.json',
                    ))),
            BottomNavigationBarItem(
                icon: SizedBox(
                    width: 34,
                    height: 34,
                    child: Image.asset("assets/svga/tab/ic_dating.png")),
                label: "约会",
                activeIcon: const SizedBox(
                    width: 34,
                    height: 34,
                    child: LottieIcon(
                      name: 'assets/svga/json/square.json',
                    ))),
            BottomNavigationBarItem(
                icon: SizedBox(
                    width: 34,
                    height: 34,
                    child: Image.asset("assets/svga/tab/ic_msg.png")),
                label: "消息",
                activeIcon: const SizedBox(
                    width: 34,
                    height: 34,
                    child: LottieIcon(
                      name: 'assets/svga/json/message.json',
                    ))),
            BottomNavigationBarItem(
                icon: SizedBox(
                    width: 34,
                    height: 34,
                    child: Image.asset("assets/svga/tab/ic_me.png")),
                label: "我的",
                activeIcon: const SizedBox(
                    width: 34,
                    height: 34,
                    child: LottieIcon(
                      name: 'assets/svga/json/mine.json',
                    ))),
          ],
          currentIndex: controller.currentIndex.value,
          onTap: (index) {
            controller.setIndex(index);
          },
        );
      }),
    );
  }
}
